<template>
  <div class="container-com-b">
    <el-button @click="fn()" type="primary">我是B组件，点击给A组件传值</el-button>
  </div>
</template>

<script type="text/javascript">
// 导入事件总线
import eventBus from "@/eventBus";

export default {
  data() {
    return {
      data: "我是B组件的数据"
    };
  },
  methods: {
    fn() {
      eventBus.$emit("b2a", this.data);
    }
  }
};
</script>

<style scoped lang="less" >
</style>
